/*
 * Copyright (C) 2014 Realtek Semiconductor Corp.
 * All Rights Reserved.
 *
 * This program is the proprietary software of Realtek Semiconductor
 * Corporation and/or its licensors, and only be used, duplicated,
 * modified or distributed under the authorized license from Realtek.
 *
 * ANY USE OF THE SOFTWARE OTHER THAN AS AUTHORIZED UNDER
 * THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
 *
 */


#include "app_basic.h"

MIB_TABLE_INFO_T gMibSIPAgentConfigDataTableInfo;
MIB_ATTR_INFO_T  gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_ATTR_NUM];
MIB_TABLE_SIPAGENTCONFIGDATA_T gMibSIPAgentConfigDataDefRow;
MIB_TABLE_OPER_T gMibSIPAgentConfigDataOper;

GOS_ERROR_CODE SIPAgentConfigDataDrvCfg(void* pOldRow, void* pNewRow, MIB_OPERA_TYPE operationType, MIB_ATTRS_SET attrSet, UINT32 pri)
{
    MIB_TABLE_SIPAGENTCONFIGDATA_T  *pMibSIPAgentConfigData = NULL, *pOldMibSIPAgentConfigData = NULL;
	omci_voice_vendor_t             voice_vendor;

	voice_vendor = (gInfo.voiceVendor ? VOICE_VENDOR_RTK : VOICE_VENDOR_NONE);

    pMibSIPAgentConfigData = (MIB_TABLE_SIPAGENTCONFIGDATA_T*)pNewRow;
    pOldMibSIPAgentConfigData = (MIB_TABLE_SIPAGENTCONFIGDATA_T*)pOldRow;

	OMCI_LOG(OMCI_LOG_LEVEL_DBG, "Start %s...", __FUNCTION__);

    switch (operationType)
    {
    case MIB_ADD:
    	OMCI_LOG(OMCI_LOG_LEVEL_DBG, "SIPAgentConfigData --> ADD");

    	break;
    case MIB_SET:
    	OMCI_LOG(OMCI_LOG_LEVEL_DBG, "SIPAgentConfigData --> SET");

        omci_voice_vendor_service_cb(voice_vendor, NULL);

		if (MIB_IsInAttrSet(&attrSet, MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGEXPTIME_INDEX))
		{
			OMCI_LOG(OMCI_LOG_LEVEL_WARN, "%s(%d) %u"  , __FUNCTION__ , __LINE__ , pMibSIPAgentConfigData->SIPRegExpTime);
		}

		if (MIB_IsInAttrSet(&attrSet, MIB_TABLE_SIPAGENTCONFIGDATA_TCPUDPPOINTER_INDEX) &&
            pMibSIPAgentConfigData->TCPUDPPointer != pOldMibSIPAgentConfigData->TCPUDPPointer)
		{
            MIB_TABLE_IP_HOST_CFG_DATA_T *pIpHost = NULL;

            if (GOS_OK == omci_check_iphost_relation_by_service(IF_SERVICE_SIP, &pIpHost, NULL))
                omci_setup_mgmt_interface(OP_SET_IF, IF_CHANNEL_MODE_IPOE, IF_SERVICE_SIP, pIpHost, NULL);
		}

    	break;
    case MIB_DEL:
    	OMCI_LOG(OMCI_LOG_LEVEL_DBG, "SIPAgentConfigData --> DEL");

       // omci_voice_vendor_service_cb(voice_vendor, NULL);
    	break;
    default:
    	break;
    }

    return GOS_OK;
}
GOS_ERROR_CODE mibTable_init(MIB_TABLE_INDEX tableId)
{
    gMibSIPAgentConfigDataTableInfo.Name = "SIPAgentConfigData";
    gMibSIPAgentConfigDataTableInfo.ShortName = "SIPACD";
    gMibSIPAgentConfigDataTableInfo.Desc = "SIP agent config data";
    gMibSIPAgentConfigDataTableInfo.ClassId = (UINT32)(OMCI_ME_CLASS_SIP_AGENT_CFG_DATA);
    gMibSIPAgentConfigDataTableInfo.InitType = (UINT32)(OMCI_ME_INIT_TYPE_OLT);
    gMibSIPAgentConfigDataTableInfo.StdType = (UINT32)(OMCI_ME_TYPE_STANDARD);
    gMibSIPAgentConfigDataTableInfo.ActionType = (UINT32)(OMCI_ME_ACTION_CREATE | OMCI_ME_ACTION_DELETE | OMCI_ME_ACTION_SET | OMCI_ME_ACTION_GET);
    gMibSIPAgentConfigDataTableInfo.pAttributes = &(gMibSIPAgentConfigDataAttrInfo[0]);

    gMibSIPAgentConfigDataTableInfo.attrNum = MIB_TABLE_SIPAGENTCONFIGDATA_ATTR_NUM;
    gMibSIPAgentConfigDataTableInfo.entrySize = sizeof(MIB_TABLE_SIPAGENTCONFIGDATA_T);
    gMibSIPAgentConfigDataTableInfo.pDefaultRow = &gMibSIPAgentConfigDataDefRow;

    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].Name = "EntityId";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PROXYSERVERADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ProxyServerAddressPointer";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_OUTBOUNDPROXYADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Name = "OutboundProxyAddressPointer";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PRIMARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].Name = "PrimarySIPDNS";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SECONDARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].Name = "SecondarySIPDNS";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_TCPUDPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Name = "TCPUDPPointer";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGEXPTIME_INDEX - MIB_TABLE_FIRST_INDEX].Name = "SIPRegExpTime";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREREGHEADSTARTTIME_INDEX - MIB_TABLE_FIRST_INDEX].Name = "SIPReregHeadStartTime";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_HOSTPARTURI_INDEX - MIB_TABLE_FIRST_INDEX].Name = "HostPartURI";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPSTATUS_INDEX - MIB_TABLE_FIRST_INDEX].Name = "SIPStatus";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGISTRAR_INDEX - MIB_TABLE_FIRST_INDEX].Name = "SIPRegistrar";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SOFTSWITCH_INDEX - MIB_TABLE_FIRST_INDEX].Name = "Softswitch";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].Name = "SIPResponseTable";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPOPTIONTRANSMITCONTROL_INDEX - MIB_TABLE_FIRST_INDEX].Name = "SIPOptionTransmitControl";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPURIFORMAT_INDEX - MIB_TABLE_FIRST_INDEX].Name = "SIPURIFormat";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_REDUNDANTSIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Name = "RedundantSIPAgentPointer";

    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Entity ID";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PROXYSERVERADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Proxy server address pointer";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_OUTBOUNDPROXYADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Outbound proxy address pointer";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PRIMARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Primary SIP DNS";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SECONDARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Secondary SIP DNS";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_TCPUDPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "TCP UDP pointer";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGEXPTIME_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "SIP reg exp time";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREREGHEADSTARTTIME_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "SIP rereg head start time";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_HOSTPARTURI_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Host part URI";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPSTATUS_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "SIP status";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGISTRAR_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "SIP registrar";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SOFTSWITCH_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Softswitch";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "SIP response table";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPOPTIONTRANSMITCONTROL_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "SIP option transmit control";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPURIFORMAT_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "SIP URI format";
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_REDUNDANTSIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Redundant SIP agent pointer";

    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PROXYSERVERADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_OUTBOUNDPROXYADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PRIMARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SECONDARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_TCPUDPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGEXPTIME_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREREGHEADSTARTTIME_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_HOSTPARTURI_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPSTATUS_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT8;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGISTRAR_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SOFTSWITCH_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_STR;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_TABLE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPOPTIONTRANSMITCONTROL_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT8;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPURIFORMAT_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT8;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_REDUNDANTSIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;

    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PROXYSERVERADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_OUTBOUNDPROXYADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PRIMARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SECONDARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_TCPUDPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGEXPTIME_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREREGHEADSTARTTIME_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_HOSTPARTURI_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPSTATUS_INDEX - MIB_TABLE_FIRST_INDEX].Len = 1;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGISTRAR_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SOFTSWITCH_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].Len = 5;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPOPTIONTRANSMITCONTROL_INDEX - MIB_TABLE_FIRST_INDEX].Len = 1;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPURIFORMAT_INDEX - MIB_TABLE_FIRST_INDEX].Len = 1;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_REDUNDANTSIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;

    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = TRUE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PROXYSERVERADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_OUTBOUNDPROXYADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PRIMARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SECONDARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_TCPUDPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGEXPTIME_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREREGHEADSTARTTIME_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_HOSTPARTURI_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPSTATUS_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGISTRAR_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SOFTSWITCH_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPOPTIONTRANSMITCONTROL_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPURIFORMAT_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_REDUNDANTSIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;

    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PROXYSERVERADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_OUTBOUNDPROXYADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PRIMARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SECONDARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_TCPUDPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGEXPTIME_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREREGHEADSTARTTIME_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_HOSTPARTURI_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPSTATUS_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGISTRAR_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SOFTSWITCH_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPOPTIONTRANSMITCONTROL_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPURIFORMAT_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_REDUNDANTSIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;

    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PROXYSERVERADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_OUTBOUNDPROXYADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PRIMARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SECONDARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_TCPUDPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGEXPTIME_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREREGHEADSTARTTIME_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_HOSTPARTURI_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPSTATUS_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGISTRAR_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SOFTSWITCH_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_CHAR;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_CHAR;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPOPTIONTRANSMITCONTROL_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPURIFORMAT_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_REDUNDANTSIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;

    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PROXYSERVERADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_OUTBOUNDPROXYADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PRIMARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SECONDARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_TCPUDPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGEXPTIME_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREREGHEADSTARTTIME_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_HOSTPARTURI_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPSTATUS_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGISTRAR_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SOFTSWITCH_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE ;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPOPTIONTRANSMITCONTROL_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPURIFORMAT_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_REDUNDANTSIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;

    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PROXYSERVERADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_OUTBOUNDPROXYADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PRIMARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SECONDARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_TCPUDPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGEXPTIME_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREREGHEADSTARTTIME_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_HOSTPARTURI_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPSTATUS_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = TRUE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGISTRAR_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SOFTSWITCH_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPOPTIONTRANSMITCONTROL_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPURIFORMAT_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_REDUNDANTSIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;

    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PROXYSERVERADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_OUTBOUNDPROXYADDRESSPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_PRIMARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SECONDARYSIPDNS_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_TCPUDPPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGEXPTIME_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREREGHEADSTARTTIME_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_HOSTPARTURI_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPSTATUS_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPREGISTRAR_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SOFTSWITCH_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPRESPONSETABLE_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_OPTIONAL;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPOPTIONTRANSMITCONTROL_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_OPTIONAL;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_SIPURIFORMAT_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_OPTIONAL;
    gMibSIPAgentConfigDataAttrInfo[MIB_TABLE_SIPAGENTCONFIGDATA_REDUNDANTSIPAGENTPOINTER_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_OPTIONAL;

    gMibSIPAgentConfigDataDefRow.EntityId = 0;
    gMibSIPAgentConfigDataDefRow.ProxyServerAddressPointer = 0;
    gMibSIPAgentConfigDataDefRow.OutboundProxyAddressPointer = 0;
    gMibSIPAgentConfigDataDefRow.PrimarySIPDNS = 0;
    gMibSIPAgentConfigDataDefRow.SecondarySIPDNS = 0;
    gMibSIPAgentConfigDataDefRow.TCPUDPPointer = 0xffff;
    gMibSIPAgentConfigDataDefRow.SIPRegExpTime = 3600;
    gMibSIPAgentConfigDataDefRow.SIPReregHeadStartTime = 3600;
    gMibSIPAgentConfigDataDefRow.HostPartURI = 0xffff;
    gMibSIPAgentConfigDataDefRow.SIPStatus = 0;
    gMibSIPAgentConfigDataDefRow.SIPRegistrar = 0xffff;
    strncpy(gMibSIPAgentConfigDataDefRow.Softswitch, "0", sizeof(gMibSIPAgentConfigDataDefRow.Softswitch));
    memset(gMibSIPAgentConfigDataDefRow.SIPResponseTable, 0x00, 5);
    gMibSIPAgentConfigDataDefRow.SIPOptionTransmitControl = 0;
    gMibSIPAgentConfigDataDefRow.SIPURIFormat = 0;
    gMibSIPAgentConfigDataDefRow.RedundantSIPAgentPointer = 0;

    memset(&gMibSIPAgentConfigDataOper, 0x0, sizeof(MIB_TABLE_OPER_T));
    gMibSIPAgentConfigDataOper.meOperDrvCfg = SIPAgentConfigDataDrvCfg;
    gMibSIPAgentConfigDataOper.meOperConnCheck = NULL;
    gMibSIPAgentConfigDataOper.meOperDump = omci_mib_oper_dump_default_handler;
    gMibSIPAgentConfigDataOper.meOperConnCfg = NULL;
    gMibSIPAgentConfigDataOper.meOperAvlTreeAdd = NULL;
    gMibSIPAgentConfigDataOper.meOperAlarmHandler = NULL;
    gMibSIPAgentConfigDataOper.meOperTestHandler = NULL;

    MIB_TABLE_SIPAGENTCONFIGDATA_INDEX = tableId;
    MIB_InfoRegister(tableId, &gMibSIPAgentConfigDataTableInfo, &gMibSIPAgentConfigDataOper);
    MIB_RegisterCallback(tableId, NULL, NULL);

    return GOS_OK;
}

